public class demo1 {
    public static void main(String[] args) {
      int[]array={1,2,3,4};
      String ret=mytostring(array);
        System.out.println(ret);
    }
    public static  String mytostring(int [] array){
        String str="[";
        for (int i = 0; i < array.length ; i++) {
           str=str + array[i];
           if(i!=array.length-1) {

               str = str + ",";
           }
        }
        str=str+"]";
        return str;
    }
}
